import React, { Component } from 'react';
import { base } from 'nc-lightapp-front';
const { NCTable, NCCheckbox, NCTextArea, NCModal, NCButton } = base;
const { Header, Title, Body, Footer } = NCModal;
import { ajax, toast } from 'nc-lightapp-front';
// const { Transfer } = high;
import './index.less';

const URL = {
    queryLinkContract: '/nccloud/pu/poorder/QueryLinkContractVOAction.do',
    updateOrderItems: '/nccloud/pu/poorder/UpdateOrderItemsAction.do',
};

class ZRCKModal extends Component {
    constructor(props) {
        super(props);

        this.state = {

            showZRCKModal: false
        };
        this.onConfirmss = this.onConfirmss.bind(this);

        this.closeInfoModal = this.closeInfoModal.bind(this);
        this.pks = props.pks;
        this.value = props.value;
    }






    onConfirmss = () => {
        let value = this.props.value;
        let pks = this.props.pks;
        let data = {
            value: value,
            pks: pks
        };
        ajax({
            url: '/nccloud/hrhi/psndoc/ZRCKAction.do',
            data: data,
            success: (res) => {
                this.props.onConfirms && this.props.onConfirms();
                
                this.closeInfoModal();
                
            }
        });



    }
    renderTopTitleLogo = () => {
        let { renderTopTitleLogo } = this.props;
        if (renderTopTitleLogo) {
            return renderTopTitleLogo();
        }
        return <i className={'def-modal-logo'} />
    }
    //弹窗中输入框值变化的方法
    onInputChange = (value) => {
        this.props.value = value
    }
    closeInfoModal() {
        this.props.updateState({
            showZRCKModal: false,
        });
    }

    render() {
        let showZRCKModal = this.props.showZRCKModal;
        //内容区域 提示信息前的图标
        let toastIcon = (color, showIcon) => {
            if (!showIcon) return null;
            let iconName = 'icon-wancheng';
            if (color === 'danger') {
                iconName = 'icon-shibai';
            } else if (color === 'warning') {
                iconName = 'icon-zhuyi1';
            } else if (color === 'info') {
                iconName = 'icon-tixing';
            }
            let name = `iconfont ${iconName} ${color}`;
            return <span className={name} />;
        };
        let {
            showCloseButton = false,
            onSure,
            onCancel,
            showFooter = true,
            dragable = true,
            customFooter,
            topTitle = '提示信息',
            showTopTitleIcon = true,
            title,
            content,
            show,
            color = 'success',
            showIcon = true,
            ...others
        } = this.props;
        return (
            <NCModal
                show={showZRCKModal}
                onHide={this.closeInfoModal}
                className="control-scope-transfer"
                fieldid="bill_controlscope"
            >
                <Header closeButton={true}>
                    <Title>
                        <div className={'top-title'}>
                            {
                                showTopTitleIcon && this.renderTopTitleLogo()
                            }
                            {
                                <span style={{ marginLeft: showTopTitleIcon ? '8px' : '0px' }}>{topTitle}</span>
                            }
                        </div>
                    </Title>
                </Header>
                <Body className={'prompt-box-body'}>
                    {
                        !!title && <Title fieldid="prompt-body-title" className="prompt-box-body-title">
                            {toastIcon(color, showIcon)}
                            {<div className="title-text">{typeof title === 'function' ? title() : title}</div>}
                        </Title>
                    }
                    <div >
                        <NCTextArea value={this.state.value} onChange={this.onInputChange}></NCTextArea>
                        <span>确定该员工未办理入职转入人才储备库?</span>
                    </div>
                </Body>
                <Footer>
                    <NCButton fieldid="ok" colors="primary" onClick={this.onConfirmss}  >
                        确定
                    </NCButton>
                    <NCButton fieldid="cancel" colors="default" onClick={this.closeInfoModal} >
                        取消
                    </NCButton>
                </Footer>
            </NCModal>
        );
    }
}

export default ZRCKModal;